{extend name="iframe" /}
{block name="body"}
<div>
	<ul class="layui-nav">
		<li {if condition="$resourceCode eq 'J'" }class="layui-nav-item layui-this"{else/}class="layui-nav-item"{/if}><a onclick="clickTab('J')">中文论文</a></li>
		<li {if condition="$resourceCode eq 'I'" }class="layui-nav-item layui-this"{else/}class="layui-nav-item"{/if}><a onclick="clickTab('I')">SCI</a></li>
		<li {if condition="$resourceCode eq 'E'" }class="layui-nav-item layui-this"{else/}class="layui-nav-item"{/if}><a onclick="clickTab('E')" >EI</a></li>
		<li {if condition="$resourceCode eq 'P'" }class="layui-nav-item layui-this"{else/}class="layui-nav-item"{/if}><a onclick="clickTab('P')" >专利</a></li>
		<li {if condition="$resourceCode eq 'other'" }class="layui-nav-item layui-this"{else/}class="layui-nav-item"{/if}><a onclick="clickTab('other')">其他</a></li>
	</ul>
</div>
<div class="layui-card">
	<input type="hidden" id="scholarId" name="scholarId" value="{$scholarId|default=''}" />
	<div class="layui-card-body">
        <div class="layui-btn-group">
        </div>
		<table class="layui-table layui-form">
			<thead>
			<tr>
				<th>标题</th>
				<th>年份</th>
				<th>期刊</th>
				<th>作者</th>
				<th>单位</th>
				<th>关键词</th>
				<th>操作</th>
			</tr>
			</thead>
			<tbody>
			{foreach name="list" item="v" empty="$empty"}
			<tr>
				<td>{$v.title}</td>
				<td>{$v.year}</td>
				<td>{$v.journal}</td>
				<td>{$v.creatorStandard}</td>
				<td>{$v.instituteStandard}</td>
<!--				<td>{$v.creatorAll}</td>-->
<!--				<td>{$v.instituteAll}</td>-->
				<td>{$v.keyword}</td>
				<td>
					<a onclick="del({$v.id}, this)" class="layui-btn layui-btn-xs layui-btn-danger"><i class="fa fa-trash-o"></i> 删除</a>
				</td>
			</tr>
			{/foreach}
			</tbody>
		</table>
		<div class="page">{$list->render()}</div>
	</div>
</div>
{/block}
{block name="js"}
<script>
	function clickTab(type) {
		var scholarId = $("#scholarId").val();
		if (scholarId === '' || scholarId === null || scholarId === undefined) {
			layer.msg("该学者暂无成果");
			return
		}
		if (type === '' || type === null || type === undefined) {
			type = 'J';
		}
		location.href = '/admin/scholar/resultDetail?scholarId=' + scholarId + '&resourceCode=' + type;
	}

	function del(id, e) {
		layer.confirm('确定删除？', {
			icon: 3,
			title: '提示'
		}, function (index) {
			$.ajax({
				url: '/admin/scholar/resultDel?id=' + id,
				type: 'post',
				dataType: 'json',
				success: function (result) {
					if (result.code === 1 && result.url != '') {
						layer.msg('删除成功');
						$(e).parent().parent().remove();
					}
				},
				error: function (xhr, state, errorThrown) {
					layer.msg(state + '：' + errorThrown);
				}
			});
		});
	}
</script>
{/block}